"""
@title(TenX腾晓2024年11月考核答题文件)
@warning(请勿修改参数和返回值)
@warning(请认真填写__init__中的数据)
@author(1323230180)
"""
from typing import List, Tuple


class TenXClass:
    def __init__(self):
        self.name = "郑鸿涛"
        self.id = "3124002024"

    @staticmethod
    def question1(n: int) -> list[str]:
        print(n)  # 打印，防止IDE警告
        number = 1
        jinzhi = ""
        jinzhi1 = ['1']
        for number in range(2, n + 1):
            while number > 0:
                i = number % 4
                jinzhi = str(i) + jinzhi
                number //= 4
            jinzhi1.append(jinzhi)
            jinzhi = ""
        return jinzhi1

    @staticmethod
    def question2() -> list[tuple[int, int, int]]:
        return [(8, 11, 81),
                (12, 4, 84),
                (4, 18, 78),
                (0, 25, 75)]

    @staticmethod
    def question3(equipment: list[str], prop: list[str], material: list[str], items: list[str]) -> dict[str, list[str]]:
        print(equipment, prop, material, items)  # 打印，防止IDE警告
        a = len(items)
        equipment1: list = []
        prop1: list = []
        material1: list = []
        for num in range(0, a):
            if (items[num] in equipment):
                equipment1.append(items[num])
            elif (items[num] in prop):
                prop1.append(items[num])
            elif (items[num] in material):
                material1.append(items[num])
        return {"equipment": equipment1,
                "prop": prop1,
                "material": material1}

    @staticmethod
    def question4(item_values: dict[str, int], items: list[str]) -> tuple[list[str], int]:
        print(item_values, items)  # 打印，防止IDE警告
        shumu = []
        for c in range(0, len(items)):
            shumu.append(item_values.get(items[c]))
        shumu.sort(reverse=True)
        zongzhi = shumu[0] + shumu[1] + shumu[2]
        shumu1 = []
        for b in range(0, 3):
            for key, value in item_values.items():
                if value == shumu[b]:
                    shumu1.append(key)
        shumu2 = (shumu1, zongzhi)
        return shumu2

    @staticmethod
    def question5(matrix: list[list[int]]) -> list[tuple[int, int]]:
        print(matrix)  # 打印，防止IDE警告
        difang1 = []
        target = 0
        for hang in range(len(matrix)):
            for lie in range(len(matrix[hang])):
                if matrix[hang][lie] == target:
                    difang = (hang + 1, lie + 1)
                    difang1.append(difang)
        return difang1
